﻿using Aweber.Entity;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using Aweber;
using System.Configuration;

namespace UnitTests.Entity
{


    /// <summary>
    ///This is a test class for BaseTest and is intended
    ///to contain all BaseTest Unit Tests
    ///</summary>
    [TestClass()]
    public class BaseTest
    {

        /// <summary>
        ///A test for BaseConstructor
        ///</summary>
        [TestMethod()]
        public void BaseConstructorTest()
        {
            MockAdapter adapter = new MockAdapter();

            Base target = new Base(adapter);

            Assert.IsNotNull(target);
            Assert.IsNotNull(target.api);
        }


        /// <summary>
        ///A test for Properties of the Base Class
        ///</summary>
        [TestMethod()]
        public void PropertiesLoadedTest()
        {
            string appId = ConfigurationManager.AppSettings["AweberAppId"];
            API api = new API(appId, new MockAdapter());
            api.process_appId_token(ConfigurationManager.AppSettings["AweberToken"]);

            Account target = api.getAccount();


            Assert.IsTrue(target.id > 0);
            Assert.IsFalse(String.IsNullOrEmpty(target.http_etag));
            Assert.IsFalse(String.IsNullOrEmpty(target.resource_type_link));
            Assert.IsFalse(String.IsNullOrEmpty(target.self_link));
        }

        /// <summary>
        ///A test for seeing if the properties in a class are successfully determined dirty
        ///</summary>
        [TestMethod()]
        public void PropertyDirtyTest()
        {
            // Dirty Test done in subscriber, currently the only entity to change dirty fields
        }

    }

}